#pragma once

#include "TriangleBase.h"
#include "VertexBase.h"
#include "maya/MPoint.h"
#include "maya/MVector.h"

class EdgeBase
{	
public:
	struct queueElement {EdgeBase* edge; TriangleBase* tri; VertexBase* start; VertexBase* end;};

	EdgeBase(int index, VertexBase* start, VertexBase* end, bool border);
	~EdgeBase(void);
	double getAngleInTriangle(VertexBase* third);

	void addTriangle(TriangleBase* tri, VertexBase* opposite);
	friend bool operator== (EdgeBase &cP1, EdgeBase &cP2);
	//Returns the next triangle of this edge. Or returns null
	TriangleBase* getNextTriangle(TriangleBase* in);
	bool alreadyProjectedTriangle(TriangleBase* in);
	void setAlreadyProjected(TriangleBase* in);

	VertexBase* getStart();
	VertexBase* getEnd();

	void setWeight();
	double getWeight();
	int getNum();
	bool isBoundary();

	VertexBase* getOpposite(TriangleBase* tri);
	void fixOppositeVertices(queue<queueElement>* fixingQueue, TriangleBase* tri, VertexBase* start, VertexBase* end);
	void print();

private:
	map<TriangleBase*, VertexBase*> triangles;
	map<TriangleBase*, bool> alreadyProjected;

	bool borderEdge;
	double weight;
	VertexBase* start;
	VertexBase* end;
	int index;
	
	//VertexBase* alreadyProjStart;
	//VertexBase* alreadyProjEnd;

};

